package com.winit.core.configuration.util;

import com.winit.common.util.Constants;

/**
 * Created by wangjian on 16/8/2.
 */
public class ConfigRepositoryUtil {

    /**
     * 获取默认ConfigRepository下环境路径
     * @param envName
     * @return
     */
    public static String getDefaultConfigEnvPath(String envName){
        return getConfigEnvPath(Constants.CONFIG_REPOSITORY_PATH,envName);
    }

    public static String getConfigEnvPath(String rootPath,String envName){
        StringBuffer path = new StringBuffer();
        path.append(rootPath).append("/").append(getEnv(envName)).append("/").append(envName);
        return path.toString();
    }

    public static String getEnv(String envName){
        return envName.split("\\.")[0].toUpperCase();
    }
}
